package ac.github.os.internal.core.selector.impl

import ac.github.os.api.common.SingleList
import ac.github.os.internal.core.condition.callVoid
import ac.github.os.internal.core.config.StringConfig
import ac.github.os.internal.core.objective.Objective
import ac.github.os.internal.core.selector.Selector
import ac.github.os.internal.core.trigger.PlayerTrigger
import ac.github.os.internal.session.Cache
import ac.github.os.internal.session.Session
import ac.github.os.util.adaptObjective
import taboolib.common.LifeCycle
import taboolib.common.platform.Awake

@Awake
class ThisSelector : Selector {
    override fun doSelect(session: Session, config: StringConfig): SingleList<Objective> {
        return SingleList<Objective>().apply {
            session.callVoid<PlayerTrigger> {
                add(it.player.adaptObjective())
            }
        }
    }

    override val namespace: String
        get() = "this"
}